home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
PET
/
S-Super PET
/
(s)tl.d64
/
SCRNDMP.ASM
< prev
next >
Wrap
Assembly Source File
|
2009-01-18
|
4KB
|
147 lines
opt nolist
; Screen Dump Routines as of 03/24/84
; by T.M. Peterson (with help from his friends)
xref TGetCurs_,Openf_,Closef_,FPutRec_,FPutNL_
xref FPutChar_,Scroll_Stop
xref ScrnDmpType
xdef Dump_to_ieee4,Dump_to_disk,NMI_jump
; Following code is assumed to be in bank-switched memory
; and therefore needs no protection from over-writing by
; user programs.
NMI_jump equ * ;Come here on shift-RVS
bsr tstSTOP ;Is STOP down too?
if ne ;Yes
clr Scroll_Stop
leas 4,s ;Dump RTS addrs.
jmp [$10C] ;Treat like NMI
else
com Scroll_Stop ;No, just toggle flag
endif
rts ;ignore
; Test for STOP key: row 9, bit 4
; CC(Z)=1 if not stop
tstSTOP ldd #$910
tstIT pshs b
sei
STA $e810 ;sel. row
andb $e812 ;mask bit(s)
cli
cmpb ,s ;all set?
leas 1,s ;clr stk
RTS ;Z=1 means bit(s) set (i.e., ky NOT dn)
tstStopFlg equ *
tst Scroll_Stop ;Was shift-RVS pressed?
if eq ;no
leas 2,s ;dump rts & quit
endif
clr Scroll_Stop ;Clr it now
rts
wrtype fcb 'W',0
prname0 fcc "ieee4" ;Select if ScrnDmpType = $X0
fcb 0
prname1 fcc "printer" ; " if " = $X1
fcb 0
prname2 fcc "serial" ;(You guessed it!)
fcb 0
aptype fcb 'A',0
dskname fcc "disk8/0.Screen_Dump"
fcb 0
Dump_to_ieee4 equ *
bsr tstStopFlg ;in shift-RVS 'mode'? (no ret. if so)
guess
ldb ScrnDmpType ;Is printer 'ieee4'?
andb #3 ;Only l.s. 2 bits matter
quif ne ;not ieee
ldd #prname0 ;Set filename pointer
admit
decb ;Is 'printer'?
quif ne ;wrong again
ldd #prname1
admit
ldd #prname2 ;must be 'serial'
endguess
ldx #wrtype
bsr opn1 ;open file
bne prnt ;success
rts
Dump_to_disk equ *
bsr tstStopFlg
ldb ScrnDmpType ;Save printer flags
pshs b
clr ScrnDmpType ;(No LFs NOW)
ldx #aptype ;Try to append
bsr dopn
if eq ;oops, failed.
ldx #wrtype ; OK, try to create file
bsr dopn
endif
if ne ;success
bsr prnt
endif
puls b
stb ScrnDmpType
rts
dopn ldd #dskname ;Disk filename
opn1 pshs x
JSR Openf_ ;go open it
LEAS 2,S
RTS
prnt LEAS -4,S ;res some stack space
STD $02,S ;save cntrl blk
JSR FPutNL_
LDX #$8000 ;start at CRT beg.
prnt1 STX ,S ;save pntr
LDB #79 ;max 80 chars/line
LDA #$20 ;space
loop
CMPA B,X ;look for eol
quif ne ;here it is
DECB ;to beg. of line?
until mi
CLRA
INCB ;adj. count
PSHS d
PSHS x
LDD $06,S ;get cntrl blk ptr
JSR FPutRec_ ;print#P1, (P2).(P3)
tst ScrnDmpType ;Req. LF?
if mi ;yes
ldb #10
std ,s
ldd 6,s ;get fcb
jsr FPutChar_ ;send LF
endif
LEAS 4,S ;clean stack
lbsr tstSTOP ;test for STOP
bne prnt2
LDX ,S ;get pntr back
LEAX 80,X ;bump to nxt line
tfr x,d ;make copy
anda #$7f ;strip CRT offset
cmpd $122 ;back to crsr?
blo prnt1 ;no, loop
prnt2 LDD $02,S ;close file
JSR Closef_
LEAS 4,S ;release stk space
RTS
end